Skip to content

EagleEye contents with actions#483

Merged
joanreyero merged 37 commits into
feature/eagle-eye-2from
improvement/eagle-eye-contents-v2
Feb 8, 2023
Merged

EagleEye contents with actions#483
joanreyero merged 37 commits into
feature/eagle-eye-2from
improvement/eagle-eye-contents-v2

Conversation

@epipav
Copy link
Copy Markdown
Collaborator

@epipav epipav commented Feb 5, 2023

Changes proposed ✍️

  • We now store posts as JSON when a user makes an action on a content
  • To achieve this we now store actions along with POI EagleEye contents, with these endpoints:

To upsert content into the database:
POST /api/eagleEyeContent
Upserts eagle eye content using post URL. If a post doesn't exist on our database yet, we also support sending actions along with it. (ie: on create we support adding actions to content, but on update we don't -> on existing content, one should be using the new action endpoints)

An example body payload when creating a fresh eagle eye content:

{
    platform: 'reddit',
    url: 'https://some-post-url',
    post: {
      title: 'post title',
      body: 'post body',
    },
    postedAt: '2020-05-27T15:13:30Z',
}

To create an action for an eagle eye post:
POST /api/eagleEyeContent/:contentId/actions

{
    type: 'bookmark|thumbs-up|thumbs-down',
    timestamp: '2022-06-27T14:13:30Z',
}

This endpoint also makes sure that, when a mutually exclusive action (:+1: or :-1: ) is sent, the counterpart is deleted. IE: When sending a thumbs-up or thumbs-down action, we don't have to send another request to delete the counterpart.

To delete an action for an eagle eye post:
DELETE /api/eagleEyeContent/:contentId/action/:actionId

To list eagle eye posts with filtering:
POST /api/eagleEyeContent/query
Some example body payloads for various filters:

  1. Get posts that were bookmarked by all tenant users
{
    filter: {
        action: {
            type: 'bookmark',
         },
}

This will return all actions of the matched content (ie: if content has at least one bookmark, it'll be returned with all of its actions)

  1. Get posts that were bookmarked by one tenant user
{
    filter: {
        action: {
            type: 'bookmark',
            actionById: '#userId'
         },
}

Checklist ✅

  • Label appropriately with Feature, Enhancement, or Bug.
  • Tests are passing.
  • New backend functionality has been unit-tested.
  • Environment variables have been updated:
    • Local frontend configuration: frontend/.env.dist.local, frontend/.env.dist.composed.
    • Local backend: backend/.env.dist.local, backend/.env.dist.composed.
    • Configuration docs have been updated.
    • Team members only: update environment variables in override, staging and production env. files and trigger update config script.
  • API documentation has been updated (if necessary) (see docs on API documentation).
  • Quality standards are met.
  • All changes have been tested in a staging site.
  • All changes are working locally running crowd.dev's Docker local environment.

@epipav epipav self-assigned this Feb 5, 2023
@epipav epipav added the Improvement Created by Linear-GitHub Sync label Feb 5, 2023
@epipav
Copy link
Copy Markdown
Collaborator Author

epipav commented Feb 5, 2023

@joanreyero one question: I'm not sure what to do with backend/src/serverless/integrations/usecases/hackerNews/getPostsByKeywords.ts
it's using keywordMatch from eagleEyeContent and afaik we won't have this function anymore?

@epipav epipav requested a review from joanreyero February 5, 2023 20:35
@joanreyero
Copy link
Copy Markdown
Contributor

@anilb0stanci I re-wrote this so it does not need the old EagleEye

@joanreyero joanreyero changed the base branch from main to feature/eagle-eye-2 February 8, 2023 11:59
@joanreyero joanreyero marked this pull request as ready for review February 8, 2023 11:59
@joanreyero joanreyero merged commit 32c4b25 into feature/eagle-eye-2 Feb 8, 2023
@joanreyero joanreyero deleted the improvement/eagle-eye-contents-v2 branch February 8, 2023 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Improvement Created by Linear-GitHub Sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants